package com.xinqi.modules.sys.document.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.sys.document.dto.req.DocumentManagerQueryDTO;
import com.xinqi.modules.sys.document.dto.rsp.DocumentManagerResultDTO;
import com.xinqi.modules.sys.document.service.DocumentManagerService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文档管理表内部控制层
 *
 * @author: gzy
 * @date: 2023/05/28
 */
@Hidden
@RestController
@RequestMapping("/inner/document-manager")
@RequiredArgsConstructor
public class DocumentManagerInnerController {
    private final DocumentManagerService documentManagerService;

    /**
     * 文档管理表-分页
     */
    @GetMapping("/page")
    public R<PageInfo<DocumentManagerResultDTO>> page(Param pageable, DocumentManagerQueryDTO dto) {
        PageInfo<DocumentManagerResultDTO> page = documentManagerService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 文档管理表-详情
     */
    @GetMapping("/{id}")
    public R<DocumentManagerResultDTO> findById(@PathVariable("id") Long id) {
        DocumentManagerResultDTO dto = documentManagerService.findById(id);
        return R.data(dto);
    }
}
